//
//  CompanyHeaderView.m
//  QXShowing
//
//  Created by 王道道 on 2018/7/22.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#import "CompanyHeaderView.h"

@implementation CompanyHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI {
    UILabel *introLabel = [[UILabel alloc] init];
    introLabel.text = @"·介绍";
    [self addSubview:introLabel];
    [introLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(20);
        make.right.equalTo(self.mas_right).offset(-10);
    }];
    
    self.companyNameLabel = [[UILabel alloc] init];
    self.companyNameLabel.text = @"上海企线信息科技有限公司";
    self.companyNameLabel.textColor = Text_Color_000000;
    self.companyNameLabel.font = BHFont_Size_12;
    self.companyNameLabel.adjustsFontSizeToFitWidth = YES;
    [self addSubview:self.companyNameLabel];
    [self.companyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(introLabel.mas_left).offset(5);
        make.top.equalTo(introLabel.mas_bottom).offset(20);
        make.right.equalTo(introLabel.mas_right);
    }];
    
    self.companyNumberLabel = [[UILabel alloc] init];
    self.companyNumberLabel.text = @"展位号：111";
    self.companyNumberLabel.textColor = Text_Color_282828;
    self.companyNumberLabel.font = BHFont_Size_12;
    self.companyNumberLabel.adjustsFontSizeToFitWidth = YES;
    [self addSubview:self.companyNumberLabel];
    [self.companyNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(introLabel.mas_left).offset(5);
        make.top.equalTo(self.companyNameLabel.mas_bottom).offset(20);
        make.right.equalTo(introLabel.mas_right);
    }];
    
    self.companyInfoLabel = [[UILabel alloc] init];
    self.companyInfoLabel.text = @"公司简介。。。。";
    self.companyInfoLabel.textColor = Text_Color_282828;
    self.companyInfoLabel.font = BHFont_Size_12;
    //    self.companyInfoLabel.adjustsFontSizeToFitWidth = YES;
    self.companyInfoLabel.numberOfLines = 0;
    [self addSubview:self.companyInfoLabel];
    [self.companyInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(introLabel.mas_left).offset(5);
        make.top.equalTo(self.companyNumberLabel.mas_bottom).offset(20);
        make.right.equalTo(introLabel.mas_right);
    }];
    
    UILabel *listLabel = [[UILabel alloc] init];
    listLabel.text = @"·产品简介";
    [self addSubview:listLabel];
    [listLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(introLabel.mas_left);
        make.top.equalTo(self.companyInfoLabel.mas_bottom).offset(20);
        make.right.equalTo(introLabel.mas_right);
        make.bottom.equalTo(self.mas_bottom).offset(-20);
    }];
}

- (void)setModel:(CompanyInfoModel *)model {
    if (![BHSettingUtil dataAndStringIsNull:model]) {
        _model = model;
        self.companyNameLabel.text = [BHSettingUtil dataAndStringIsNull:model.company_name]?@"公司名称：未知":model.company_name;
        self.companyNumberLabel.text = [BHSettingUtil dataAndStringIsNull:model.booth_name]?@"展位号：暂无":[NSString stringWithFormat:@"展位号：%@", model.booth_name];
        self.companyInfoLabel.text = [BHSettingUtil dataAndStringIsNull:model.Description]?@"暂无":[NSString stringWithFormat:@"%@", model.Description];
    }
}

@end
